// file name: breadth-first-search.cpp
// description: a cpp file that implements a breadth-first search
// last editor: sunist chan
// macOS Catalina 10.15.5 with Visual Studio Code and GCC11
// complie command: g++ breadth-first-search.cpp -o YOUR_PROGRAM_NAME

#include <iostream>
#include <queue>

using namespace std;

class edge
{
    public:
    int nodeA_index;
    int nodeB_index;
};

void BFS(queue<int> route, bool *visited, int index, int node_count, int search_index, bool **map)
{
    int tmp = index;
    route.push(tmp);
    visited[tmp] = true;
    while (!route.empty())
    {
        
        if (tmp == search_index)
        {
            std::cout << "FIND IT!\n";
            exit(0);
        }
        for (int i = 0; i < node_count; i++)
        {
            if (map[tmp][i] == true && visited[i] == false)
            {
                route.push(i);
                visited[i] = true;
            }
        }
        route.pop();
        tmp = route.front();
    }
    std::cout << "NOT FOUND!\n";
}

int main()
{
    int node_count, edge_count;
    std::cin >> node_count >> edge_count;
    int start_index, search_index;
    std::cin >> start_index >> search_index;

    queue<int> route;
    bool **map = NULL;
    map = new bool*[node_count];
    for (int i = 0 ; i < node_count; i++)
    {
        map[i] = new bool[node_count];
    }

    edge *edges = new edge[edge_count];
    bool *visited = new bool[node_count];

    for (int i = 0; i < edge_count; i++)
    {
        std::cin >> edges[i].nodeA_index >> edges[i].nodeB_index;
        map[edges[i].nodeA_index][edges[i].nodeB_index] = true;
        map[edges[i].nodeB_index][edges[i].nodeA_index] = true;
    }
    
    BFS(route, visited, start_index, node_count, search_index, map);

    return 0;
}